using System;
using System.Collections.Generic;
using KenEgozi.Com.Domain.Aggregates.Post;
using KenEgozi.Com.Domain.Aggregates.Tag;
using KenEgozi.Com.Domain.Interfaces.Repositories;
using NUnit.Framework;
using Rhino.Commons;

namespace KenEgozi.Com.Domain.Tests
{
	[TestFixture]
	public class PostsFixture : AbstractModelTestCase
	{
		[Test]
		public void CanGetAllPosts()
		{
			IPostsRepository postsRepository = IoC.Resolve<IPostsRepository>();
			ICollection<Post> posts = postsRepository.FindRecent();
			foreach (Post post in posts)
			{
				Console.WriteLine("{0}\t{1}", post.Id, post.Title);
				if (post.Tags.Count > 0)
				{
					Console.Write("Tags: ");
					foreach (Tag tag in post.Tags)
						Console.Write("{0}, ", tag);
					Console.WriteLine();
				}
			}
		}
	}
}
